<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增五级行政区划')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-addr-add">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">上级编码：</label>
            <div class="col-sm-8">
                <input id="treeId" name="upCode" type="hidden" th:value="${sysFivelevelAddr.code}"/>
                <input class="form-control" type="text" id="treeName" readonly="true"
                       th:value="${sysFivelevelAddr.name}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">行政区划名称：</label>
            <div class="col-sm-8">
                <input name="name" class="form-control" type="text" required>
            </div>
        </div>
        <!--<div class="form-group">-->
        <!--<label class="col-sm-3 control-label is-required">城乡分类代码：</label>-->
        <!--<div class="col-sm-8">-->
        <!--<input name="typ" class="form-control" type="text" required>-->
        <!--</div>-->
        <!--</div>-->

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">层级：</label>
            <div class="col-sm-8">
                <input name="pLevel" th:value="${pLevel}" class="form-control" type="text" readonly>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "system/addr"
    $("#form-addr-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-addr-add').serialize());
        }
    }

    /*五级行政区划-新增-选择父部门树*/
    function selectAddrTree() {
        var options = {
            title: '五级行政区划选择',
            width: "380",
            url: prefix + "/selectAddrTree/" + $("#treeId").val(),
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero) {
        var body = $.modal.getChildFrame(index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        $.modal.close(index);
    }
</script>
</body>
</html>